c# cvalidate email

102

c# cvalidate email -

bool IsValidEmail(string email)
{
    if (email.Trim().EndsWith(".")) {
        return false; // suggested by @TK-421
    }
    try {
        var addr = new System.Net.Mail.MailAddress(email);
        return addr.Address == email;
    }
    catch {
        return false;
    }
}

Comments

Submit
0 Comments